NPC Script

Home : Game : Map Maker : Sprite Maker : Enemies : NPC Script


NPC Script Format

An NPC (Non-Player Character) Script usually contains the following elements:

  1. STARTMODE #
  2. script
  3. ENDMODE

The STARTMODE # and ENDMODE commands tell when the script is to begin and in what mode. You can include several scripts in one file.

The first line in any NPC script file (.npc) is line 1, which means that any IDE with row numbers can help you a great deal.

NPC Script Commands

NOTE: Most of these commands have to be typed with the exact number of characters as shown by the numbers.

Any exceptions are usually noted with a “...” which means any number of characters can be used with that function.

An example of correct notation is as follows:

SAY 02 02 000 050 Hello everyone!

This command will display “Hello everyone!” in 8-bit text at Row 2, Column 2 with each character shown every 50 milliseconds.

BATTLE 1 222 333

Initiates a battle.

  1. Enemy number in the map (see Enemies Menu on the Map Page.)
  2. Line in the script to go to if you win
  3. Line in the script to go to if you lose

BOX 1 222 333 444 555 666 777 888

Places a box on the screen.

  1. Box Mode
    • If Box Mode is 0, the x-y coordinates are normal.
    • If Box Mode is 1, the x-y coordinates are based on row and column for the LOCATE command in FreeBasic. The equation from Box Mode 1 to Box Mode 0 is: row =16*(y-1), and column = 8*(x-1).
    • If Box Mode is 2, the x-y coordinates are based on the row and column, respectively, of the 8 -bit text . The equation from Box Mode 2 to Box Mode 0 is: row = 8*y, and column = 8*x.
  2. First X or Row Coordinate
  3. First Y or Column Coordinate
  4. Second X or Row Coordinate
  5. Second Y or Column Coordinate
  6. Box Color (can be from 000-255)
  7. Border Color (can be from 000-255)
  8. Shadow Color (can be from 000-255)

CASH 122222 333

Adds or takes away gold.

  1. + or -, depending on the transaction.
  2. Number of gold.
  3. Line in the script to go to in case the player doesn't have enough gold

CCHECK 11 22

Displays your gold total in 8-bit text.

  1. Mode 2 Row
  2. Mode 2 Column

CHOICE 1 22 33 444 555 6...

Places 8-bit text on the screen as a choice.

  1. Choice number
  2. Mode 2 Row of text
  3. Mode 2 Column of text
  4. Type any three-digit number. I am error. :)
  5. Delay between characters in milliseconds.
  6. Text (can be any length)

CHOOSE

Activates the choice-maker.

Note: in the game, make your choice with the up and down keys and press SPACE to make a selection.

COLLECT 1.. 222

Places item in inventory.

  1. Name of item
  2. Line to go to if there is no room in inventory

ENDMODE

Ends the NPC interaction and returns the player to the game.

GOTO 111

Takes the player to the given line in the script.

  1. Line number

HEALTH 1222

Adds or takes away HP.

  1. + or -, depending on the situation.
  2. Number of HP.

IFCHOICE 1 222

Checks whether a certain choice was made. If so, the NPC script goes to a certain line.

  1. Choice to test
  2. Line in the script

IFDATE 1 22334444 55

Checks whether it is a certain month, day, and/or year. If so, the NPC script goes to a certain line.

  1. Mode
    • If mode is 0, checks for the correct month, day, OR year.
    • If mode is 1, checks for the correct month, day, AND year.
  2. Month (can be from 01-12)
  3. Day (can be from 01-31)
  4. Year (can be from 0000-9999)
  5. Line in the script

IFLOC 1... 2...

Checks whether you're in a certain mapfile. If so, executes a code.

  1. Mapfile
  2. Code

IFLOOK 1 222

Checks whether you're looking up(0), left(1), down(2), or right(3). If so, takes you to the given line.

  1. Look code
  2. Line in the script

IFRAND 11 222

Checks for a certain random number. If it matches, the NPC script goes to a certain line.

  1. Number
  2. Line in the script

IFTIME 1 2233 4455 777

Checks the time. If the time matches the specifications, the NPC script goes to a certain line.

  1. Mode
    • If mode is 0, checks if the time is NOT within the given range.
    • If mode is 1, checks if the time IS within the given range.
  2. Hour 1 (can be from 00-23)
  3. Minute 1 (can be from 00-59)
  4. Hour 2 (can be from 00-23)
  5. Minute 2 (can be from 00-59)
  6. For the Hexakosioihekekontahexaphobic
  7. Line in the script

IFVAR122 33333 444 555

Checks for a certain variable value in the NPC variable set and goes to a certain line accordingly.

  1. Can be the following:
    • Nothing or =: Equal to
    • X: Not equal to
    • <: Less than
    • >: Greater than
    • ): Greater than or equal to
    • (: Less than or equal to
  2. NPC variable number
  3. NPC variable value
  4. Line in the script to go to if true
  5. Line in the script to go to if false

IFWEEK 1111111 222

Checks for a certain day of the week and goes to the line if true.

  1. DOW code: for each digit in the seven digit code, the first is either Sunday or Monday, etc. I'm not too sure about this one.
  2. Line in the script

INVGET 1... 222

Places an item in your inventory.

  1. Inventory code (can be any size)
  2. Line in the script to go to in case a player "gives up" placement

INVGIVE 1... 222

Takes an item away from your inventory.

  1. Inventory code (can be any size)
  2. Line in the script to go to in case you don't have the item in question.

NEWMODE 1

Jumps to a new mode in the script.

  1. Mode

PAUSE 1111

Delays the script.

  1. Number of milliseconds (can be from 0000-9999)

Note: PAUSE 0000 will stop the script until a user presses a key.

SAY 11 22 333 444 5...

Places 8-bit text on the screen.

  1. Mode 2 Row of text.
  2. Mode 2 Column of text.
  3. Type any three-digit number. This value is irrelevant.
  4. Delay between characters in milliseconds.
  5. Text (can be any length)

SCREENSHOT

Displays the screen.

SETRAND 11 22

Generates a random number between two positive integers between 01-99.

  1. First number
  2. Second number

SPACE

Takes the character to the space screen.

SPCODE 11 22 333

Changes a sprite in the map.

  1. X-tile
  2. Y-tile
  3. Sprite code (see Changing Sprite Attributes on the Map Page.)

Note: This change is only temporary, and unless a WRITE command is used, will be reveresed when you leave the map.

SPRITE 1 2... 333 444

Places a sprite on the screen.

  1. Number of letters in the sprite name
  2. Sprite name (1-9 characters)
  3. X Coordinate (can be from 000-639)
  4. Y Coordinate (can be from 000-479)

SPWEAPON 1

Gives you a special weapon, albeit only temporary until you leave the game.

  1. Special Weapon Number
    1. Sword: Gives you more attack power.
    2. Boomerang: Attacks your opponent and possibly stunning them.
    3. Smokescreen: Allows you to leave the battle.
    4. Energy: Transfers SP to HP.
    5. Transporter Part / Super Sword: Powers your sword and gives you a transporter part.
    6. Transporter Part / Superang: Powers your boomerang and gives you a transporter part.

STARTMODE 1

Begins any script. This line is essential in an NPC script and should be the very first line.

  1. NPC Script Mode (See NPC Script Format)

VAR 11 233333

Changes an NPC variable.

  1. Variable Number
  2. Modifier, either +, -, =, *(multiply), /(divide to integer), ^(power), or M(modular)
  3. Number value

WARP 11 22 33 44 5...

Takes the player to a specified map.

  1. X-Start coordinate or how many tiles the map will scroll to the right before placement.
  2. Y-Start coordinate, or how many tiles the map will scroll down before placement.
  3. Number of tiles to the right the player will go. (charx / 32)
  4. Number of tiles down the player will go. (chary / 32)
  5. Map file name (can be any length)

WRITE 1...

Writes to the game file (.qst) concerning sprites and NPC characters.

  1. Code

Code for the WRITE Command

1... 22 33 444

Changes a sprite on any map. Such changes stay with that .qst file.

  1. Map name (can be any size)
  2. X-Tile
  3. Y-Tile
  4. Sprite code (see the Map Page.)

@ 1 2...

Changes NPC character attributes. Such changes stay with that .qst file.

  1. NPC Number (see the Map Page.)
  2. NPC Code (see the Map Page.)

S1

Sets special weapons. Such changes stay with that .qst file.

  1. Special Weapon Number (see SWEAPON)